<section class="header clearfix">
  {{#if isView}}
    <div class="right-buttons pull-right">
      {{badge-state model=model}}
      {{action-menu
        model=model
        showPrimary=false
        classNames="ml-10 inline-block"
        size="sm"
      }}
    </div>
  {{/if}}

  <h1>
    {{title}}
  </h1>
</section>

{{#if isView}}
  {{#if model.description}}
    {{banner-message
      color="bg-secondary mb-0 mt-10"
      message=(linkify model.description)
    }}
  {{/if}}
{{else}}
  {{form-name-description
    nameDisabled=isEdit
    model=primaryResource
    nameRequired=(not isEdit)
    namePlaceholder="newSecret.name.placeholder"
    descriptionPlaceholder="newSecret.description.placeholder"
  }}
{{/if}}

{{optionally-namespaced
  namespaceErrors=namespaceErrors
  scope=scope
  mode=mode
  namespace=namespace
  model=model
}}

<div class="box mt-10 mb-20">
  <label class="acc-label">
    {{t "newSecret.values.label"}}
  </label>
  {{form-key-value
    allowEmptyValue=true
    initialMap=primaryResource.data
    addActionLabel="newSecret.addActionLabel"
    addInitialEmptyRow=true
    base64Value=true
    concealValue=true
    editing=notView
    trimWhenMultiLines=false
    changed=(action "updateData")
  }}
</div>

<div class="row mt-20">
  <FormLabelsAnnotations
    @classNames="accordion-wrapper"
    @expandAll={{al.expandAll}}
    @initialLabels={{primaryResource.labels}}
    @model={{primaryResource}}
    @editing={{editing}}
  />
</div>

{{#accordion-list showExpandAll=false as | al expandFn |}}
  {{#if isView}}
    {{form-related-workloads
      workloads=model.workloads
      expandAll=al.expandAll
      expandFn=expandFn
    }}
  {{/if}}
{{/accordion-list}}

{{#unless isView}}
  {{top-errors errors=errors}}
  {{save-cancel
    editing=true
    save=(action "save")
    cancel=(action "viewEditCancel" )
  }}
{{/unless}}
